package com.example.test99;

import androidx.appcompat.app.AppCompatActivity;

import android.content.ContentValues;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

    private MyDatabaseHelper dbHelper;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        dbHelper = new MyDatabaseHelper(this,"Contacts.db",null,2);
        dbHelper.getWritableDatabase();
        SQLiteDatabase db = dbHelper.getWritableDatabase();
        ContentValues values = new ContentValues();

//        组装一条信息
        values.put("name","lily mono");
        values.put("number",13246126);
        values.put("gender","woman");
        db.insert("Contacts",null ,values);
        values.clear();
        //        组装一条信息
        values.put("name","mike mono");
        values.put("number",13265426);
        values.put("gender","man");
        db.insert("Contacts",null ,values);
        values.clear();

    }
}